package net.jueb.juebCore.script;

import java.util.List;
import net.jueb.juebCore.net.NetConnection;
import net.jueb.util4j.hotSwap.classFactory.IScript;

/**
 * 服务器脚本
 * @author juebanlin@gmail.com
 * time:2015年6月17日
 */
public interface IServerScript extends IScript{

	public void setRequest(Request request);
	
	public Request getRequest();
	
	public void setRunMode(RunMode mode);
	
	public RunMode getRunMode();
	
	public List<Object> getParams();
	
	public void setParams(Object ...params);
	
	public void action();
	
	public void handleRequest(Request request);
	
	public static enum RunMode{
		/**
		 * 执行操作
		 */
		Action,
		/**
		 * 执行请求处理
		 */
		HandleRequest;
	}
	
	public static class Request {
		private NetConnection connection;
		private Object content;

		public Request() {
			
		}

		public Request(NetConnection connection, Object content) {
			super();
			this.connection = connection;
			this.content = content;
		}

		public NetConnection getConnection() {
			return connection;
		}

		public void setConnection(NetConnection connection) {
			this.connection = connection;
		}

		public Object getContent() {
			return content;
		}

		public void setContent(Object content) {
			this.content = content;
		}
	}
}
